<%= form_for(@case) do |f| %>
  <% if @case.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@case.errors.count, "error") %> prohibited this case from being saved:</h2>

      <ul>
      <% @case.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :case_num %><br />
    <%= f.text_field :case_num %>
  </div>
  <div class="field">
    <%= f.label :case_status %><br />
    <%= f.text_field :case_status %>
  </div>
  <div class="field">

    <%= f.label :employee_id %><br />
    
    <%= f.select "employee_id", options_for_select(@employee.collect{|employee| [employee.full_name , employee.id]} ),:include_blank => true  unless @employee.nil? %>
  </div>
  <div class="field">
    <%= f.label :client_id %><br />
    <%= f.select "client_id", options_for_select(@client.collect{|client| [client.full_name, client.id ]  } ) unless @client.nil? %>
  </div><br/>

  <div class="field">
    <%= f.label :HearingLocation %><br />
    <%= f.text_area :hearing_location,:id=>"map_canvas", :rows=>5, :cols=>40 %>
<%=link_to (image_tag 'maps.png'), '#',:class => 'map'%>

</div>


  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
<script>
$(".map").live('click',function() {
 var address = $("#map_canvas").val();
window.open("http://local.google.com/maps?daddr="+address);


var sayHello = new LiveValidation( "sayHello", { validMessage: "Hey there!", wait: 500 } );
});
var f1 = new LiveValidation('case_case_num');
f1.add( Validate.Presence );
f1.add( Validate.Numericality );
var f2 = new LiveValidation('map_canvas');
f2.add( Validate.Presence );
var f2 = new LiveValidation('case_employee_id');
f2.add( Validate.Presence );

</script>
